component	
	name		= 'EntryService' 
	singleton	= 'true' 
	extends		= 'model.BaseService'
{
	public function init() {
	 	BeanName = 'EntryBean';
	}
	
	public function new() {
		var oEntry = super.new();
		oEntry.setCreationDate(now());
		return oEntry;
	}
	
	public function read(ID) {
		var oEntry = super.read(ID);
		oEntry.setNbViews(oEntry.getNbViews()+1);
		oEntry.save();
		return oEntry;
	}
	
	public function load(numeric offset=0) {
		var aEntries = entityLoad(
			'EntryBean',
			{IsPublished=true},
			'CreationDate desc',
			{offset = arguments.offset,maxResults = 10});
		return aEntries;
	}
}
